<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>迷你博客-登录</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            background-color: #f4f4f4;
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }
        
        .navbar {
            background-color: #333;
            padding: 15px 0;
        }
        
        .navbar-brand {
            color: white;
            font-size: 24px;
            font-weight: bold;
            margin: 0 auto;
            text-align: center;
        }
        
        .login-container {
            max-width: 400px;
            margin: 30px auto;
            padding: 30px;
            background: white;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        
        .login-header {
            text-align: center;
            margin-bottom: 25px;
            color: #333;
            font-size: 24px;
            font-weight: bold;
        }
        
        .form-control {
            height: 45px;
            margin-bottom: 20px;
        }
        
        .btn-login {
            background-color: #007bff;
            color: white;
            height: 45px;
            font-weight: bold;
            margin-bottom: 15px;
        }
        
        .register-link {
            text-align: center;
            display: block;
            color: #007bff;
            text-decoration: none;
        }
        
        .error-message {
            color: #dc3545;
            text-align: center;
            margin-top: 15px;
            font-weight: bold;
        }
        
        .footer {
            text-align: center;
            padding: 15px 0;
            color: white;
            background-color: #333;
            margin-top: auto;
        }
    </style>
</head>
<body>
    <nav class="navbar navbar-expand-lg">
        <div class="container-fluid">
            <a class="navbar-brand" href="#">迷你博客-登录</a>
        </div>
    </nav>

    <div class="container">
        <div class="login-container">
            <div class="login-header">登录</div>
            <form method="POST" action="{{ url_for('home.login') }}">
                <div class="mb-3">
                    <label for="username" class="form-label">用户名</label>
                    <input type="text" class="form-control" id="username" name="username" placeholder="请输入用户名">
                </div>
                <div class="mb-3">
                    <label for="password" class="form-label">密码</label>
                    <input type="password" class="form-control" id="password" name="password" placeholder="请输入密码">
                </div>
                <button type="submit" class="btn btn-login w-100">登录</button>
                <a href="/register" class="register-link">注册</a>
                
                {% with messages = get_flashed_messages() %}
                    {% if messages %}
                        <div class="error-message">
                            {% for message in messages %}
                                {{ message }}
                            {% endfor %}
                        </div>
                    {% endif %}
                {% endwith %}
            </form>
        </div>
    </div>

    <footer class="footer">
        <div class="container">
            <p class="mb-0">© 2024 Mini Blog All rights reserved.</p>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>